﻿IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'usp_UPDMS_FIT_TRAINING_TYPE_Insert')
	BEGIN
		DROP Procedure usp_UPDMS_FIT_TRAINING_TYPE_Insert
	END
GO

SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
GO
/******************************************************************************
**	Name : usp_UPDMS_FIT_TRAINING_TYPE_Insert
**	Desc : 운동종류관리를 저장한다.
**	Test Exec Query : Exec usp_UPDMS_FIT_TRAINING_TYPE_Insert
**	Called by : Fit_Dac_UPDMS_FIT_TRAINING_TYPE.cs
**	Program ID : Fit1010m
**	Auth : 송시명
**	Date : 2014-05-19
*******************************************************************************
**	Change History
*******************************************************************************
**	Date:		Author:		Description:
**	--------	--------	---------------------------------------
**			
*******************************************************************************/
CREATE PROC [dbo].[usp_UPDMS_FIT_TRAINING_TYPE_Insert]
@Seq int,
@Training_Type_Id nvarchar(5),
@Training_Part nvarchar(5),
@Training_Nm nvarchar(200),
@Training_Muscle_Major nvarchar(max),
@Training_Muscle_Minor nvarchar(max),
@Howto nvarchar(max),
@Precaution nvarchar(max),
@Tip nvarchar(max),
@Weight_Calc_Rate decimal(10,1),
@View_Order nvarchar(5),
@Favorite_Yn nvarchar(1),
@Use_Yn nvarchar(1),
@Attach_File_Info nvarchar(max),
@Create_User nvarchar(20),
@Create_Dt datetime,
@Update_User nvarchar(20),
@Update_Dt datetime
AS
SET NOCOUNT OFF

DECLARE @New_Seq int

INSERT INTO UPDMS_FIT_TRAINING_TYPE (
       Training_Type_Id,
       Training_Part,
	   Training_Nm,
	   Training_Muscle_Major,
	   Training_Muscle_Minor,
       Howto,
       Precaution,
	   Tip,
	   Weight_Calc_Rate,
	   View_Order,
       Favorite_Yn,
       Use_Yn,
       Create_User,
       Create_Dt,
       Update_User,
       Update_Dt
)
VALUES (
       @Training_Type_Id,
       @Training_Part,
	   @Training_Nm,
	   @Training_Muscle_Major,
	   @Training_Muscle_Minor,
       @Howto,
       @Precaution,
	   @Tip,
	   @Weight_Calc_Rate,
	   @View_Order,
       @Favorite_Yn,
       @Use_Yn,
       @Create_User,
       GETDATE(),
       @Update_User,
       GETDATE()
)

SET @New_Seq = @@IDENTITY

--첨부파일 저장
EXEC usp_UPDMS_COM_FILE_Insert_Xml @New_Seq, 'Fit1010m', @Attach_File_Info

GO